/*
 * @Description:
 * @Author: zhaolei
 * @Date: 2023-04-19 11:56:10
 */

import request from '@/router/axios';

// 根据通过宠物id查询领养记录
export function getAdoptRecordById(petId) {
  return request({
    url: `/core/adopt/${petId}`,
    method: 'get',
  });
}

//添加云领养套餐
export const addAdoptionPack = (data) => {
  return request({
    url: '/core/cloud/adopt/pack',
    method: 'post',
    data,
  });
};
// 获取云领养套餐列表
export const fetchPackList = (params) => {
  return request({
    url: '/core/cloud/adopt/pack/page',
    method: 'get',
    params,
  });
};
//修改套餐状态
export const updatePackStatus = (id, status) => {
  return request({
    url: `/core/cloud/adopt/pack/status/${id}/${status}`,
    method: 'put',
  });
};
//获取套餐详情
export const getPackDetail = (id) => {
  return request({
    url: `/core/cloud/adopt/pack/${id}`,
    method: 'get',
  });
};
//修改套餐
export const updatePack = (data) => {
  return request({
    url: '/core/cloud/adopt/pack',
    method: 'put',
    data,
  });
};
//云领养记录
export const fetchAdoptRecordList = (params) => {
  return request({
    url: '/core/cloud/adopt/record/page',
    method: 'get',
    params,
  });
};
//云养订单列表
export const fetchAdoptOrderList = (params) => {
  return request({
    url: '/core/virtual/order/page',
    method: 'get',
    params,
  });
};
// 云养订单交易流水
export const fetchAdoptTradeFlowList = (orderCode, params) => {
  return request({
    url: `/core/virtual/trade/page/${orderCode}`,
    method: 'get',
    params,
  });
};
//手动停止
export const manualStopOrder = (data) => {
  return request({
    url: '/core/virtual/order/stop',
    method: 'post',
    data,
  });
};
//手动停止原因
export const getManualStopReason = (orderCode) => {
  return request({
    url: `/core/virtual/order/stop/reason/${orderCode}`,
    method: 'get',
  });
};
//云养日记列表
export const fetchAdoptDiaryList = (params) => {
  return request({
    url: '/core/cloud/adopt/diary/manage/page',
    method: 'get',
    params,
  });
};
//恢复或者屏蔽日记
export const adoptDiaryShield = (id, status) => {
  return request({
    url: `/core/cloud/adopt/diary/shield/${id}/${status}`,
    method: 'put',
  });
};
//审核日记
export const auditAdoptDiary = (data) => {
  return request({
    url: '/core/cloud/adopt/diary/audit',
    method: 'put',
    data,
  });
};
// 云养日记详情
export const getAdoptDiaryDetail = (id) => {
  return request({
    url: `/core/cloud/adopt/diary/${id}`,
    method: 'get',
  });
};
//日记统计（月）
export const getDairyOfMonthStatistics = (params) => {
  return request({
    url: '/core/cloud/adopt/diary/statistics/month',
    method: 'get',
    params,
  });
};

//日记统计（日）
export const getDairyOfDayStatistics = (params) => {
  return request({
    url: '/core/cloud/adopt/diary/statistics/day',
    method: 'get',
    params,
  });
};
// 云养日记审核不通过日记
export const getAuditFailRecord = (userId, petId) => {
  return request({
    url: `/core/cloud/adopt/diary/audit/notPass/${userId}/${petId}`,
    method: 'get',
  });
};
//审核备注记录
export const getDiaryAuditRemark = (id) => {
  return request({
    url: `/core/cloud/adopt/diary/audit/${id}`,
    method: 'get',
  });
};

// 指派负责人
export const assignAdoptPerson = (data) => {
  return request({
    url: '/core/cloud/adopt/record/assign/person',
    method: 'post',
    data,
  });
};
// 负责人修改记录
export const adoptChangeLogRecord = (recordId) => {
  return request({
    url: `/core/cloud/adopt/record/person/change/record/${recordId}`,
    method: 'get',
  });
};
//区域管理列表
export const fetchAdoptAreaList = (params) => {
  return request({
    url: '/core/cloud/adopt/area/page',
    method: 'get',
    params,
  });
};

///新增云管理区域
export const addAdoptArea = (data) => {
  return request({
    url: '/core/cloud/adopt/area',
    method: 'post',
    data,
  });
};
//获取区域管理详情
export const getAdoptAreaDetail = (id) => {
  return request({
    url: `/core/cloud/adopt/area/${id}`,
    method: 'get',
  });
};
//更新领养区域
export const updateAdoptArea = (data) => {
  return request({
    url: '/core/cloud/adopt/area',
    method: 'put',
    data,
  });
};
//获取云养区域下的宠物
export const getAdoptAreaPet = (areaId) => {
  return request({
    url: `/core/cloud/adopt/area/list/pet/${areaId}`,
    method: 'get',
  });
};
//取消停止云认养订单
export const cancelStopOrder = (orderCode) => {
  return request({
    url: `/core/virtual/order/cancel/stop/${orderCode}`,
    method: 'post',
  });
};
